'\" te
.\" Copyright (c) 2001, Sun Microsystems, Inc.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH ACLTOTEXT 3SEC "Dec 10, 2001"
.SH NAME
acltotext, aclfromtext \- convert internal representation to or from external
representation
.SH SYNOPSIS
.nf
\fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-lsec\fR [ \fIlibrary\fR... ]
#include <sys/acl.h>

\fBchar *\fR\fBacltotext\fR(\fBaclent_t *\fR\fIaclbufp\fR, \fBint\fR \fIaclcnt\fR);
.fi

.LP
.nf
\fBaclent_t *\fR\fBaclfromtext\fR(\fBchar *\fR\fIacltextp\fR, \fBint *\fR\fIaclcnt\fR);
.fi

.SH DESCRIPTION
The \fBacltotext()\fR function converts an internal \fBACL\fR representation
pointed to by \fIaclbufp\fR into an external \fBACL\fR representation. The
space for the external text string is obtained using \fBmalloc\fR(3C). The
caller is responsible for freeing the space upon completion.
.sp
.LP
The \fBaclfromtext()\fR function converts an external \fBACL\fR representation
pointed to by \fIacltextp\fR into an internal \fBACL\fR representation.  The
space for the list of \fBACL\fR entries is obtained using \fBmalloc\fR(3C). The
caller is responsible for freeing the space upon completion. The \fIaclcnt\fR
argument indicates the number of \fBACL\fR entries found.
.sp
.LP
An external \fBACL\fR representation is defined as follows:
.sp
.LP
<acl_entry>[,<acl_entry>]\|.\|.\|.
.sp
.LP
Each <acl_entry> contains one \fBACL\fR entry. The external representation of
an \fBACL\fR entry contains two or three colon-separated fields. The first
field contains the \fBACL\fR entry tag type. The entry type keywords are
defined as:
.sp
.ne 2
.na
\fB\fBuser\fR\fR
.ad
.RS 17n
This \fBACL\fR entry with no \fBUID\fR specified in the \fBACL\fR entry
\fBID\fR field specifies the access granted to the owner of the object.
Otherwise, this \fBACL\fR entry specifies the access granted to a specific
user-name or user-id number.
.RE

.sp
.ne 2
.na
\fB\fBgroup\fR\fR
.ad
.RS 17n
This \fBACL\fR entry with no \fBGID\fR specified in the \fBACL\fR entry
\fBID\fR field specifies the access granted to the owning group of the object.
Otherwise, this \fBACL\fR entry specifies the access granted to a specific
group-name or group-id number.
.RE

.sp
.ne 2
.na
\fB\fBother\fR\fR
.ad
.RS 17n
This \fBACL\fR entry specifies the access granted to any user or group that
does not match any other \fBACL\fR entry.
.RE

.sp
.ne 2
.na
\fB\fBmask\fR\fR
.ad
.RS 17n
This \fBACL\fR entry specifies the maximum access granted to user or group
entries.
.RE

.sp
.ne 2
.na
\fB\fBdefault:user\fR\fR
.ad
.RS 17n
This \fBACL\fR entry with no uid specified in the \fBACL\fR entry \fBID\fR
field specifies the default access granted to the owner of the object.
Otherwise, this \fBACL\fR entry specifies the default access granted to a
specific user-name or user-\fBID\fR number.
.RE

.sp
.ne 2
.na
\fB\fBdefault:group\fR\fR
.ad
.RS 17n
This \fBACL\fR entry with no gid specified in the \fBACL\fR entry \fBID\fR
field specifies the default access granted to the owning group of the object.
Otherwise, this \fBACL\fR entry specifies the default access granted to a
specific group-name or group-\fBID\fR number.
.RE

.sp
.ne 2
.na
\fB\fBdefault:other\fR\fR
.ad
.RS 17n
This \fBACL\fR entry specifies the default access for other entry.
.RE

.sp
.ne 2
.na
\fB\fBdefault:mask\fR\fR
.ad
.RS 17n
This \fBACL\fR entry specifies the default access for mask entry.
.RE

.sp
.LP
The second field contains the \fBACL\fR entry \fBID\fR, as follows:
.sp
.ne 2
.na
\fB\fBuid\fR\fR
.ad
.RS 9n
This field specifies a user-name, or user-\fBID\fR if there is no user-name
associated with the user-\fBID\fR number.
.RE

.sp
.ne 2
.na
\fB\fBgid\fR\fR
.ad
.RS 9n
This field specifies a group-name, or group-\fBID\fR if there is no group-name
associated with the group-\fBID\fR number.
.RE

.sp
.ne 2
.na
\fB\fBempty\fR\fR
.ad
.RS 9n
This field is used by the user and group \fBACL\fR entry types.
.RE

.sp
.LP
The third field contains the following symbolic discretionary access
permissions:
.sp
.ne 2
.na
\fB\fBr\fR\fR
.ad
.RS 9n
read permission
.RE

.sp
.ne 2
.na
\fB\fBw\fR\fR
.ad
.RS 9n
write permission
.RE

.sp
.ne 2
.na
\fB\fBx\fR\fR
.ad
.RS 9n
execute/search permission
.RE

.sp
.ne 2
.na
\fB\fB\(mi\fR \fR
.ad
.RS 9n
no access
.RE

.SH RETURN VALUES
Upon successful completion, the \fBacltotext()\fR function returns a pointer to
a text string. Otherwise, it returns \fBNULL\fR.
.sp
.LP
Upon successful completion, the \fBaclfromtext()\fR function returns a pointer
to a list of \fBACL\fR entries. Otherwise, it returns \fBNULL\fR.
.SH ATTRIBUTES
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Evolving
_
MT-Level	Unsafe
.TE

.SH SEE ALSO
.BR acl (2),
.BR malloc (3C),
.BR attributes (7)
